﻿<UserControl x:Class="ProTemplate.UserControls.CustomControl.MainFeeForm"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:input="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input"
    xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    mc:Ignorable="d"
    d:DesignHeight="500" d:DesignWidth="600">
    <UserControl.Resources>
        <Style TargetType="TextBlock" x:Key="AddDeclarationLable">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Width" Value="70" />
        </Style>

        <Style TargetType="TextBox" x:Key="AddDeclarationInputBox">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Width" Value="380" />
        </Style>
        <Style TargetType="input:AutoCompleteBox" x:Key="AddDeclarationAutoCompleteBoxStyle">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Width" Value="380" />
        </Style>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="30"></RowDefinition>
            <RowDefinition Height="30"></RowDefinition>
        </Grid.RowDefinitions>
        <telerikGridView:RadGridView x:Name="gvFee" telerik:Theming.Theme="Office_Blue" Style="{StaticResource CommonRadGridView}" ShowGroupPanel="False"  SelectionMode="Single"
                                     ItemsSource="{Binding Path=Items, Source={StaticResource FinancialExportDeclarationViewModel}}" >
            <telerikGridView:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="序号" DataMemberBinding="{Binding Index}" IsFilterable="False" />
                <telerik:GridViewDataColumn Header="费用类型" DataMemberBinding="{Binding FeeTypeName}" IsFilterable="False" />
                <telerik:GridViewDataColumn Header="费用" DataMemberBinding="{Binding Amount}" IsFilterable="False" />
                <telerik:GridViewDataColumn Header="成本" DataMemberBinding="{Binding Cost}" IsFilterable="False" />
                <!--<telerik:GridViewDataColumn Header="备注" DataMemberBinding="{Binding Remark}" IsFilterable="False" />-->
                <telerikGridView:GridViewDataColumn Header=""  IsReorderable="False" IsFilterable="False">
                    <telerikGridView:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <telerik:RadButton x:Name="btnEdit" Click="btnEdit_Click" IsEnabled="{Binding Remark, Converter={StaticResource DataRowButtonIsEnabledConverter}}">
                                    <Image Source="/ProTemplate;component/Images/Icons/edit.png" ToolTipService.ToolTip="编辑" Style="{StaticResource ToolBarIconStyle}" />
                                </telerik:RadButton>
                                <telerik:RadButton x:Name="btnDelete" Margin="3,0" Click="btnDelete_Click" IsEnabled="{Binding Remark, Converter={StaticResource DataRowButtonIsEnabledConverter}}">
                                    <Image Source="/ProTemplate;component/Images/Icons/delete.png" ToolTipService.ToolTip="删除" Style="{StaticResource ToolBarIconStyle}" />
                                </telerik:RadButton>
                            </StackPanel>
                        </DataTemplate>
                    </telerikGridView:GridViewDataColumn.CellTemplate>
                </telerikGridView:GridViewDataColumn>
            </telerikGridView:RadGridView.Columns>
        </telerikGridView:RadGridView>
        <StackPanel Grid.Row="1" Orientation="Horizontal">
            <TextBlock Text="费用类型：" Style="{StaticResource WindowInputLabel}" ></TextBlock>
            <input:AutoCompleteBox x:Name="acbFeeType" Width="160" Style="{StaticResource AddDeclarationAutoCompleteBoxStyle}" FilterMode="None" Populating="acbFeeType_Populating" ValueMemberPath="Name" SelectionChanged="acbFeeType_SelectionChanged" >
                <input:AutoCompleteBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Name}" />
                    </DataTemplate>
                </input:AutoCompleteBox.ItemTemplate>
            </input:AutoCompleteBox>
            <TextBlock Text="费用：" Style="{StaticResource WindowInputLabel}" Margin="20,0,0,0" ></TextBlock>
            <TextBox Name="tbAmount" Style="{StaticResource WindowInput}" Width="80" />
            <TextBlock Text="成本：" Style="{StaticResource WindowInputLabel}" ></TextBlock>
            <TextBox Name="tbCost" Style="{StaticResource WindowInput}" Width="80" />
            <Button x:Name="btnAddFeeType"  Width="55" VerticalAlignment="Center" Height="20" Margin="10,0" Content="添加" Click="btnAddFeeType_Click" />
            <StackPanel x:Name="spUpdateFeeType" Orientation="Horizontal" Visibility="Collapsed">
                <Button x:Name="btnUpdateFeeType"  Width="55" VerticalAlignment="Center" Height="20" Margin="10,0" Content="更新" Click="btnUpdateFeeType_Click"  />
                <Button x:Name="btnCancelFeeType"  Width="55" VerticalAlignment="Center" Height="20" Content="取消" Click="btnCancelFeeType_Click"  />
            </StackPanel>
        </StackPanel>
        <StackPanel Grid.Row="2" Orientation="Horizontal">
            <TextBlock Text="财务备注：" Style="{StaticResource WindowInputLabel}" ></TextBlock>
            <TextBox Name="tbRemark" Style="{StaticResource WindowInput}" Width="500" Margin="0,3,0,3" />
            </StackPanel>
        </Grid>

</UserControl>
